#include <iostream>
#define N 100

using namespace std;

void read_matrix(int matrix[][N], int row, int column){
int i, j;
for (i=0;i<row;i++)
    for(j=0;j<column;j++){
        cout<<"m["<<i<<"]["<<j<<"]= ";
        cin>>matrix[i][j];}
}

int average_matrix(int matrix[][100], int row, int column){
int sum=0;
int i, j;
for (i=0;i<row;i++)
	for(j=0;j<column;j++)
        sum+= matrix[i][j];
return sum/(row*column);
}


int main(){
int row;
int column;
int avg;
int matrix[N][N];

cout<<"Type the number of rows: " ;
cin>>row;

cout<<"Type the number of columns: " ;
cin>>column;

read_matrix(matrix, row, column);
avg=average_matrix(matrix, row, column);
cout<<"The average of the matrix elements is: ";
cout<<avg<<"\n";


return 0;
}
